
<script>
    function submitForm() {
        document.getElementById("formularioBusca").submit();
    }



function envia_status(id){
    
    var status;   
    status = document.getElementById('solicitacoes_status_'+id).value;
    
    
    document.getElementById('solicitacoes_status').value = status;
    document.getElementById('solicitacoes_id').value = id;
    
        document.getElementById("formularioEditar").submit();
    
}



</script>

<?php
if (isset($_GET['status'])) {
    $status = $_GET['status'];
} else {
    $status = 0;
}
?>

<div class='row2' >
    <div class=''>
        <h1>
            <small>
                <i class='fi-list-bullet' style='font-size: 35px; padding-right: 10px; margin-left: 5px;'></i><span style='vertical-align: 6px;'>Minhas Solicitações</span>
            </small>
        </h1>
    </div> 

</div>

<br />
<form name="formularioBusca" id="formularioBusca" method="get" action="">
    <div class="row2" >
        <div style="float: left" >


            <label>Status:
                <select name="status" id="status"  style="width: 340px" >
                    <option <?php if ($status == 0) { echo "selected='selected'"; } ?> value="">--Todos--</option>
                    <option <?php if ($status == 1) { echo "selected='selected'"; } ?>  value="1">Solicitado</option>
                    <option <?php if ($status == 2) { echo "selected='selected'"; } ?>  value="2">Em atendimento</option>
                    <option <?php if ($status == 3) { echo "selected='selected'"; } ?>  value="3">Resolvido</option>
                </select>
            </label>                   
        </div>

        <div style="float: left; vertical-align: middle">

            <a class="medium" style="color: #000; font-size: 35px; padding-right: 10px; margin-left: 10px;" target="_blank" title="Filtrar" onclick="submitForm()">
                <i class="fi-magnifying-glass big"></i>
            </a>

        </div>   
    </div>
</form>


<form name="formularioEditar" id="formularioEditar" action="<?php echo base_url('index.php/solicitacoes/salvar/') ?>" method="post"> 
    <input type="hidden" name="solicitacoes_id" id="solicitacoes_id" value="">
    <input type="hidden" name="solicitacoes_status" id="solicitacoes_status" value="">
</form>
<br />
<br />
<br />
<br />
<div class='row2' >
<table width='100%'  class='table table-bordered table-hover' border='1px' cellspacing='0' cellpadding='0'>
    <thead>
        <tr>
<td width='30%' bgcolor='#f0f0f0'><center>Empresa</center></td> 
<td width='10%' bgcolor='#f0f0f0'><center>Tipo CND</center></td> 
<td width='10%' bgcolor='#f0f0f0'><center>Data</center></td> 
<td width='5%' bgcolor='#f0f0f0'><center>Status</center></td> 
<td width='20%' bgcolor='#f0f0f0'><center>Responsável</center></td> 
</tr>
</thead>	<?php
$contador = 0;
foreach ($solicitacoes as $tabela) {
    $contador++;
    ?> 
    <tr>
        <td><?php echo $tabela->pessoas_razaoSocial ?></td>  
        <td><?php echo $tabela->tipoCnd_descricao ?></td>  
        <td><?php echo data_mostra_usa($tabela->solicitacoes_datasolicitacao) ?></td>  
        <td>
                   <?php if ($tabela->solicitacoes_status == 1) { echo "Aguardando Atendimento"; } ?>
                   <?php if ($tabela->solicitacoes_status == 2) { echo "Em atendimento"; } ?> 
                   <?php if ($tabela->solicitacoes_status == 3) { echo "Resolvido"; } ?>
            </td>  
        <td><?php echo $tabela->responsavel ?></td>  

       
    </tr>
<?php } ?> 
<tr style='font-weight:bold;' >
    <td bgcolor='#f0f0f0' colspan='8'>
        Quantidade de solicitacoes: <?php echo $contador; ?>
    </td>
</tr>

</table>
</div>